package com.ztjava.score;

import com.jfinal.config.Constants;
import com.jfinal.config.Handlers;
import com.jfinal.config.Interceptors;
import com.jfinal.config.Plugins;
import com.jfinal.config.Routes;
import com.jfinal.plugin.redis.Cache;
import com.jfinal.plugin.redis.Redis;
import com.jfinal.template.Engine;
import com.ztjava.core.Constant;
import com.ztjava.core.Jsub;
import com.ztjava.core.base.BaseSub;
import com.ztjava.core.tool.ConfigTool;
import com.ztjava.score.model.ScoreType;
import com.ztjava.score.tool.ScoreViewTool;

public class Score extends BaseSub{

	@Override
	public void configConstant(Constants me) {
		
		
	}

	@Override
	public void configRoute(Routes me) {
		
		
	}

	@Override
	public void configEngine(Engine me) {
		
		me.addSharedMethod(new ScoreViewTool());
	}

	@Override
	public void configPlugin(Plugins me) {
		
		
	}

	@Override
	public void configInterceptor(Interceptors me) {
		
		
	}

	@Override
	public void configHandler(Handlers me) {
		
		
	}

	@Override
	public void afterJFinalStart() {
		Cache cache = Redis.use();
		if(Jsub.dev||!cache.hexists(Constant.R_BASEDATA,"SCORE_TYPE")){
			ConfigTool.dbToBaseData("SCORE_TYPE", ScoreType.tablename, "id asc");
		}
		
	}

	@Override
	public void startComplete() {
		
		
	}

}
